# coding: UTF-8
# @Date    ：2024/10/15 14:23 
# @File    : __init__.py.py
# :Author:  fum

from pathlib import Path


class PathUtil:

    @classmethod
    def get_src(cls):
        """
        获取src路径
        Returns:
            Path: src路径对象
        """
        return Path(__file__).resolve().parents[3]

    @classmethod
    def get_resources(cls):
        """
        获取resources目录
        Returns:
            Path: resources目录路径对象
        """
        return cls.get_src() / "resources"

    @classmethod
    def get_env(cls):
        """
        env文件路径
        Returns:
            Path: env文件路径对象
        """
        env_file = cls.get_resources() / ".env"
        path_file = Path(env_file)
        if not path_file.exists():
            raise FileNotFoundError("未找到环境配置文件")
        return env_file

    @classmethod
    def get_tests(cls):
        """
        获取tests目录
        Returns:
            Path: tests目录路径对象
        """
        return cls.get_src() / "tests"

    @classmethod
    def get_root(cls):
        """获取根目录"""
        return cls.get_src() / "fm"

    @classmethod
    def get_templates(cls):
        """ templates 目录"""
        return cls.get_resources() / "templates"
